/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package se.karolinska.corticostriatal.ROI_plot;

import mmcorej.CMMCore;
import org.micromanager.api.ScriptInterface;
import org.micromanager.utils.ReportingUtils;

/**
 *
 * @author Matthijs
 */
public class ROI_plot implements org.micromanager.api.MMPlugin {

    public static String        menuName           = "ROI plot";
    public static String        tooltipDescription = "Plot image intensity in multiple ROI's.";

    public static CMMCore               core;
    public static plotDialog            dialog;
    public static ScriptInterface       scripts;
    

    /**
     *  Show the calcium imaging dialogue interface. If it was already opened
     *  earlier, this will move it to the front so it becomes visible again.
     */
    @Override public void show () {
        ReportingUtils.logMessage("Showing the ROI plot dialog.");
        if (dialog != null)
            dialog.dispose();

        new roiHandler();
        dialog      = new plotDialog();
        dialog.setVisible(true);
    }
    
    
    /**
     *  Hide / close the plugin.
     */
    public static void hide () {
        ReportingUtils.logMessage("Hiding the ROI plot dialog.");        
        if (dialog != null)
            dialog.dispose();
        roiHandler.hideManager();
    }


    /**
     *  Set references to the application and MicroManager core.
     * 
     *  @param si   ScriptInterface to the application.
     */
    @Override public void setApp (ScriptInterface si) {
        core            = new CMMCore();
        scripts         = si;
    }


    /**
     *  Plug-in information, description, copyright, etc.
     */
    @Override public String 
            getDescription()      { return "ROI plot plugin.";  }
    @Override public String 
            getInfo()             { return "ROI plot plugin.";  }
    @Override public String 
            getVersion()          { return "0.1-20032014";                    }
    @Override public String 
            getCopyright()        { return "Karolinska Institutet, Stockholm, 2014. Author: Matthijs Dorst"; }
    @Override public void 
            dispose ()              {}    
}
